/*
 * Copyright 2006-2008 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package net.martinimix.domain.payment;

import java.io.Serializable;

/**
 * Provides an order payment.
 * 
 * @author Scott Rossillo
 *
 */
public class Payment implements Serializable {

	private static final long serialVersionUID = 1L;
	
	public final static String STATUS_AUTHORIZED = "AUT";
	public final static String STATUS_BILLING_COMPLETE = "BIL";
	public final static String STATUS_CANCELED = "CAN";
	public final static String STATUS_INVALID = "INV";
	public final static String STATUS_PENDING_AUTHORIZATION = "PND";
	
	public final static String TYPE_ACCOUNT = "ACT";
	public final static String TYPE_CREDIT_CARD = "CCD";
	
	/**
	 * @@BusinessObjectProperty("pay_id"); 
	 */
	private Long id;
	
	/**
	 * @@BusinessObjectProperty("pay_orh_id"); 
	 */
	private Long orderHeaderId;
	
	/**
	 * @@BusinessObjectProperty("pay_type_id"); 
	 */
	private Long paymentTypeId;
	
	/**
	 * @@BusinessObjectProperty("type_cd"); 
	 */
	private String paymentType;
	
	/**
	 * @@BusinessObjectProperty("status_cd"); 
	 */
	private String statusCode;
	
	private CreditCardTransaction creditCardTransaction;
	
	private PaymentTransaction paymentTransaction;
	
	/**
	 * Creates a new payment.
	 */
	public Payment() { }

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getOrderHeaderId() {
		return orderHeaderId;
	}

	public void setOrderHeaderId(Long orderHeaderId) {
		this.orderHeaderId = orderHeaderId;
	}

	public Long getPaymentTypeId() {
		return paymentTypeId;
	}

	public void setPaymentTypeId(Long paymentTypeId) {
		this.paymentTypeId = paymentTypeId;
	}

	public String getPaymentType() {
		return paymentType;
	}

	public void setPaymentType(String paymentType) {
		this.paymentType = paymentType;
	}

	public String getStatusCode() {
		return statusCode;
	}

	public void setStatusCode(String statusCode) {
		this.statusCode = statusCode;
	}

	/**
	 * Returns the most recent credit card transaction for this payment.
	 * 
	 * @return the most recent <code>CreditCardTransaction</code> for this
	 * payment
	 */
	public CreditCardTransaction getCreditCardTransaction() {
		return creditCardTransaction;
	}

	/**
	 * Sets the most recent transaction for this payment.
	 * 
	 * @param creditCardTransaction the <code>CreditCardTransaction</code>
	 * for this payment
	 */
	public void setCreditCardTransaction(CreditCardTransaction creditCardTransaction) {
		this.creditCardTransaction = creditCardTransaction;
	}

	/**
	 * Returns the most recent payment transaction for this payment.
	 * 
	 * @return the paymentTransaction the most recent <code>PaymentTransaction</code>
	 */
	public PaymentTransaction getPaymentTransaction() {
		return paymentTransaction;
	}

	/**
	 * Sets the most recent payment transaction for this payment.
	 * 
	 * @param paymentTransaction the <code>PaymentTransaction</code> to set
	 */
	public void setPaymentTransaction(PaymentTransaction paymentTransaction) {
		this.paymentTransaction = paymentTransaction;
	}
	
}
